/*
 * @Author: chenxuan
 * @Date: 2022-05-18 14:40:08
 * @LastEditTime: 2022-06-09 13:50:21
 * @LastEditors: chenxuan
 */
import Vue from "vue";
import Vuex from 'vuex'
Vue.use(Vuex);
const state = {
  theme:localStorage.getItem('theme') ? localStorage.getItem('theme') :'blue',
  isCollapse: false,//菜单是否收起
  h1:0,   //顶部表单高度
  h2:0,   //表格上方工具栏高度
  fullHeight: sessionStorage.getItem('microFullHeight') ? sessionStorage.getItem('microFullHeight') :document.documentElement.clientHeight, //屏幕高度
  fullWidth:document.documentElement.clientWidth,
  baseRouter:'',
  chaosMenus:[],//当前微应用菜单
}
const getters = {
  baseRouter:(state)=>{
    return state.baseRouter
  },
  theme:(state)=>{
	return state.theme
  },
  isCollapse: (state, getter) => {
    return state.isCollapse
  },
  fullHeight: (state) => {
    return state.fullHeight
  },
  fullWidth:(state)=>{
    return state.fullWidth
  },
  h1:(state)=>{
    return state.h1
  },
  h2:(state)=>{
    return state.h2
  },
  chaosMenus:(state)=>{
    return state.chaosMenus
  }
 

}
const actions = {

}
const mutations = {
  loadbaseRouter(state,data){
    state.baseRouter=data;
  },
  switchIsCollapse(state, data) {
    state.isCollapse = data
  },
  loadFullheight(state,data){  
	  state.fullHeight=data;
  },
  getH1(state,data){
    state.h1=data
  },
  getH2(state,data){
    state.h2=data
  },
  getScreemInfo(state) {
    window.onresize = () => {	
      state.fullHeight = document.documentElement.clientHeight;
      state.fullWidth = document.documentElement.clientWidth;
    }
  },
  loadChaosMenus(state,data){
    state.chaosMenus=data;
  }
}
export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations,
  modules: {
    // layoutMicro
  }
})
